package com.competition.jingdong;

import java.util.Objects;

/**
 * @author henrydai
 * @date 2021/5/12 10:30
 */
public class NewConsume implements Comparable{
    String teamName;
    String newConsumeName;
    int length;
    int weight;
    int high;
    long volume;
    NewConsume(String teamName,String consumeName,int length,int weight,int high)
    {
        this.teamName=teamName;
        this.newConsumeName=consumeName;
        this.length=length;
        this.weight=weight;
        this.high=high;
        volume = length*weight*high;
    }

    @Override
    public String toString() {
        return teamName +
                "," + newConsumeName+
                "," + length +
                "," + weight +
                "," + high;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        NewConsume that = (NewConsume) o;
        return length == that.length && weight == that.weight && high == that.high;
    }

    @Override
    public int hashCode() {
        return Objects.hash(length, weight, high);
    }

    //体积降序排列
    @Override
    public int compareTo(Object o) {
        if(this.volume>((NewConsume) o).volume)
            return -1;
        else
            return 1;
    }
}
